package org.pr.ddddesigner.infrastructure.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * des something
 *
 * @author bufanqi
 * @date 2021-11-04 11:17
 **/
@Slf4j
@Component
public class ApplicationTask {

    @Value("${spring.application.name}")
    private String applicationName;

   /* @Autowired
    private ReactiveRedisTemplate<String, String> redisTemplate;

    @Scheduled(fixedRate = 120000)
    public void run() {
        log.info("Service heartbeat task 1");
        ServiceHeartbeat data=new ServiceHeartbeat();
        data.setTimestamp(Instant.now().toEpochMilli());
        List<CommonQueueEnum> commonQueueEnums=new ArrayList<>();
        commonQueueEnums.add(CommonQueueEnum.BUILD_MODEL_QUEUE);
        data.setConsumptionQueues(commonQueueEnums);
        data.setApplicationName(applicationName);
        ObjectRecord<String, ServiceHeartbeat> recordParsing= Record.of(data).withStreamKey(CommonQueueEnum.SERVICE_HEARTBEAT_QUEUE.name());
        redisTemplate.opsForStream().add(recordParsing).subscribe();
        log.info("Service heartbeat task 2");
    }*/
}